import {request} from './request.js'
const baseurl="http://124.93.196.45:10191"


function login(formdata){
	// console.log(formdata)
	return request(
	{
	url:"/login",
	method:'post',
	data:formdata
	})
}

function register(formdata){
	return  request(
	{url:'/register',method:'post',data:{
		username:formdata.username,
		nickname:formdata.nickname,
		password:formdata.password,
		phonenumber:formdata.phone
	}})
}
// 获取个人基本信息
function getInfo(){
	return request({
		url:'/getInfo',
		method:'get'
	})
}
// 修改个人信息
 function modInfo(formdata){
	return request({
		url:'system/user/profile',
		method:"PUT",
		data:formdata
	})
}
// 修改用户密码
 function updatapwd(formdata){
	return  request({
		url:`/system/user/profile/updatePwd?newPassword=${formdata.newPassword}&oldPassword=${formdata.oldPassword}`,
		method:'PUT',
	})
}

// 新增意见反馈
 function adduseradv(formdata){
	return  request({
		url:'/system/management/api/addUserRecharge',
		method:'post',
		data:formdata
	})
	
}
// 查询反馈列表

 function getmeanlist(){
	return  request({
		url:'/system/management/Apilist',
		method:'get',
	})
	
}


// 获取主页轮播
function getbanner(){
	return request({
		url:"/system/homePageRotation/list",
		method:'get',
	})
}

// 课程管理
function getmanage(){
	return request({
		url:"/system/SchoolCourseManage/list",
		method:'get'
	})
}

// 推荐应用接口
function getapplist(id){
	console.log(id)
	if(id){
		return request({
			url:`/system/application/list?applicationId=${id}`,
			method:'get',
		})
	}else{
		return request({
			url:"/system/application/list",
			method:'get',
		})
	}
}

// 应用分类接口
function getclassifylist(){
	return request({
		url:"/system/center/list",
		method:'get'
	})
}



// 访客系统列表
function getvisitlist(){
	return request({
		url:"/system/visitToday/list",
		method:'get'
	})
}

// 访客信息
function getvisitinfo(id){
	return request({
		url:`/system/visitToday/${id}`,
		method:'get'
	})
}

// 更改访客状态
function getvisitstatu(){
	return request({
		url:`/system/visitToday`,
		method:'PUT'
	})
}

// 新增访客
function addvisit(formdata){
	return request({
		url:`/system/visitToday`,
		method:'POST',
		data:formdata
	})
}


// 离校系统
function pastlist(){
	return request({
		url:"/system/schoolLeavingManagement/list",
	})
}

// 离校详细

function pastinfo(id){
	return request({
		url:`/system/schoolLeavingManagement/${id}`,
	})
}


// 请假管理
function leavelist(){
	return request({
		url:`/system/leaveManagement/list`,
	})
}

// 删除请假
function deleteleave(data){
	return request({
		url:`/system/leaveManagement`,
		method:'PUT',
		data
	})
}


// 充值记录接口
function getrechargelist(data){
	if(data){
		return request({
			url:`/system/rechargeTable/list?orderNumber=`+data,
			method:'get'
		})
	}else{
		return request({
			url:`/system/rechargeTable/list`,
			method:'get'
		})
	}
}



// 一卡通
function addusermoney(data){
	return request({
		url:`/system/rechargeTable/api/addUserRecharge`,
		method:'post',
		data
	})
}







export default{
	addusermoney,
	getrechargelist,
	deleteleave,
	pastinfo,
	pastlist,
	addvisit,
	getvisitinfo,
	getvisitstatu,
	getvisitlist,
	getbanner,
	getclassifylist,
	getapplist,
	getmanage,
	getmeanlist,
	baseurl,
	login,
	register,
	getInfo,
	modInfo,
	updatapwd,
	adduseradv
}